<!DOCTYPE html>
<html lang="{{ pagelng }}">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}{% block subtitle %}{% endblock %} - {{ _('Railgun') }}{% endblock %}</title>

    <!-- Bootstrap -->
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">

    <!-- Railgun project common css -->
    <link href="{{ url_for('static', filename='css/railgun.css') }}" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    {% block headScripts %}{% endblock %}
  </head>
  <body>
    <!-- General navigation bar -->
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">{{ _('Toggle navigation') }}</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="javascript: void(0);">{{ _('SECoder') }}</a>
        </div>
        <div class="collapse navbar-collapse">
          <!--
            Navigate links
            TODO: support multi-level navi items
          -->
          <ul class="nav navbar-nav">
            {%- macro show_navi_item(itm) -%}
              {%- if not itm.has_child -%}
              <li{% if itm.is_active %} class="active"{% endif %}>
                <a href="{{ itm.url }}">{{ itm.title }}</a>
              </li>
              {%- else -%}
              <li class="dropdown{% if itm.is_active %} active{% endif %}">
                <a href="{{ itm.url }}" class="dropdown-toggle" data-toggle="dropdown">{{ itm.title }}</a>
                <ul class="dropdown-menu" role="menu">
                  {%- for citm in itm.subitems %}
                  <li role="presentation"{% if citm.is_active %} class="active"{% endif %}>
                    <a role="menuitem" tabindex="-1" href="{{ citm.url }}">{{ citm.title }}</a>
                  </li>
                  {%- endfor %}
                </ul>
              </li>
              {%- endif -%}
            {%- endmacro -%}
            {%- for item in navibar %}
              {{ show_navi_item(item) }}
            {%- endfor %}
          </ul>
          <!-- Logged user info, or signup / signin links -->
        </div><!--/.nav-collapse -->
      </div>
    </div>

    <!-- General content area -->
    {% block wrapper -%}
    <div class="container" id="wrapper">
      <div class="content content-{{ request.endpoint }}">
        <!-- Flashed messages -->
        <div class="flash-messages">
          {% for c, m in get_flashed_messages(with_categories=True) -%}
          <div class="flash flash-{{ c }} panel panel-{{ c }}">
            <div class="panel-heading">{{ m }}</div>
          </div>
          {%- endfor %}
        </div>
        {% block content %}{% endblock %}
      </div>
    </div>
    {%- endblock %}<!-- /.container -->

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
    {% block tailScripts %}{% endblock %}
  </body>
</html>